From beadbdb26c35bac7c20ae464dccc2dfb61cc8e9b Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 13 Dec 2002 18:56:31 +0000 Subject: [PATCH] More accurately track unknown waypoints on input. --- gpsbabel/garmin.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gpsbabel/garmin.c b/gpsbabel/garmin.c index a05dbe221..ba0aca727 100644 --- a/gpsbabel/garmin.c +++ b/gpsbabel/garmin.c @@ -20,6 +20,7 @@ */ #include +#include #include "defs.h" #include "jeeps/gps.h" @@ -67,7 +68,19 @@ waypt_read(void) wpt_tmp->description = way[i]->cmnt; wpt_tmp->position.longitude.degrees = way[i]->lon; wpt_tmp->position.latitude.degrees = way[i]->lat; - if (way[i]->alt == (float) (1<<31)) { + /* + * If a unit doesn't store altitude info (i.e. a D103) + * gpsmem will default the alt to INT_MAX. Other units + * (I can't recall if it was the V (D109) hor the Vista (D108) + * return INT_MAX+1, contrary to the Garmin protocol doc which + * says they should report 1.0e25. So we'll try to trap + * all the cases here. Yes, libjeeps should probably + * do this and not us... + */ + if ((way[i]->alt == (float) (1<<31)) || + (way[i]->alt == INT_MAX) || + (way[i]->alt == 1.0e25) + ) { wpt_tmp->position.altitude.altitude_meters = unknown_alt; } else { wpt_tmp->position.altitude.altitude_meters = way[i]->alt; -- 2.30.2